home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nintendo Holiday 2009-2010
/
Nintendo Holiday.iso
/
mac
/
dyemagazine.swf
/
scripts
/
FFlippingBookSymbol.as
< prev
next >
Wrap
Text File
|
2009-10-24
|
70KB
|
2,085 lines
function FFlippingBookConstants()
{
this.DELIMITER = "%!!!%";
this.INVALID_XML_MSG = "FFlippingBookError: Incorrect XML source..";
this.MEDIA_INTERVAL = 300;
this.MEDIA_TIMEOUT = 3000;
this.PAGE_TIMEOUT = 3000;
this.DEF_PAGE_NAME = "fpage";
this.PAGE_SHADOW_LAYER_NAME = "shadows";
this.PAGE_BG_NAME = "bg";
this.PAGE_HOLDER_NAME = "holder";
this.PAGE_HOLDER_PARENT_NAME = "parent";
this.PAGE_PRELOADER_NAME = "loader";
this.PAGE_MEDIA_NAME = "media";
this.PAGE_MASK_NAME = "pmask";
this.SYMBOL_PRELOADER_NAME = "FFlippingBookLoaderSymbol";
this.PRELOADER_BAR_NAME = "bar_mc";
this.MAIN_OBJ_ID = "MAIN";
this.MODEL_OBJ_ID = "MODEL";
this.CACHE_OBJ_ID = "CACHE";
this.CONSTANTS_OBJ_ID = "CONSTANTS";
this.LOADER_OBJ_ID = "LOADER";
this.VIEW_OBJ_ID = "VIEW";
this.WIDTH_NODE_NAME = "WIDTH";
this.HEIGHT_NODE_NAME = "HEIGHT";
this.ALWAYS_OPENED_NODE_NAME = "ALWAYSOPENED";
this.SCALE_CONTENT_NODE_NAME = "SCALECONTENT";
this.AUTOFLIP_NODE_NAME = "AUTOFLIP";
this.FLIP_ON_CLICK_NODE_NAME = "FLIPONCLICK";
this.MOVE_SPEED_NODE_NAME = "MOVESPEED";
this.CLOSE_SPEED_NODE_NAME = "CLOSESPEED";
this.GOTO_SPEED_NODE_NAME = "GOTOSPEED";
this.FLIP_SOUND_NODE_NAME = "FLIPSOUND";
this.PAGE_BACK_NODE_NAME = "PAGEBACK";
this.LOAD_ON_DEMAND_NODE_NAME = "LOADONDEMAND";
this.CACHE_PAGES_NODE_NAME = "CACHEPAGES";
this.USE_PRELOADER_NODE_NAME = "USEPRELOADER";
this.PAGES_NODE_NAME = "PAGES";
this.FIRST_PAGE_NODE_NAME = "FIRSTPAGE";
this.SHADOWS_DEPTH_NODE_NAME = "SHADOWSDEPTH";
this.PAGE_STATIC_SHADOW1_NAME = "STATICSH1";
this.PAGE_STATIC_SHADOW2_NAME = "STATICSH2";
this.FLIP_SOUND_SYMBOL_NAME = "FFlippingBookSound";
this.NUM_TYPE_NAME = "number";
this.BOOL_TYPE_NAME = "boolean";
this.BOOL_TRUE_VAL = "TRUE";
this.BOOL_FALSE_VAL = "FALSE";
this.PRELOADER_WIDTH_SCALE = 2;
this.PRELOADER_HEIGHT_SCALE = 30;
this.MIN_PAGE_OFFSET = 0.9900000000000002;
this.MIN_PAGE_OFFSET2 = 0.9900000000000002;
this.DEF_WIDTH = 100;
this.DEF_HEIGHT = 100;
this.DEF_FIRST_PAGE = 0;
this.DEF_SHADOWS_DEPTH = 1;
this.DEF_MOVE_SPEED = 2;
this.DEF_CLOSE_SPEED = 3;
this.DEF_GOTO_SPEED = 3;
this.DEF_ALWAYS_OPENED = false;
this.DEF_FLIP_ON_CLICK = true;
this.DEF_LOAD_ON_DEMAND = true;
this.DEF_CACHE_PAGES = true;
this.DEF_USE_PRELOADER = true;
this.DEF_PAGEBACK = 11447982;
this.DEF_SCALE_CONTENT = true;
this.DEF_SOUND = "default";
this.DEF_NO_SOUND = "";
this.DEF_AUTOFLIP = 50;
this.EMPTY_PAGE = "_empty";
this.TRANSPARENT_PAGE1 = "_transp1";
this.TRANSPARENT_PAGE2 = "_transp2";
this.INIT_STATE = 0;
this.UNACTIVE_STATE = 1;
this.FLIPPING_STATE = 2;
this.FLIPOVER_STATE = 3;
this.FLIPBACK_STATE = 4;
this.AUTOFLIP_STATE = 5;
this.GOTOPAGE_STATE = 6;
this.CACHE_DEPTH = 100;
this.BOOK_DEPTH = 0;
this.PAGE_01_MC_NAME = "p01";
this.PAGE_02_MC_NAME = "p02";
this.PAGE_03_MC_NAME = "p03";
this.PAGE_04_MC_NAME = "p04";
this.MASK_03_MC_NAME = "m03";
this.MASK_12_MC_NAME = "m12";
this.SHADOW_03_MC_NAME = "s03";
this.SHADOW_04_MC_NAME = "s04";
this.SH_MASK_03_MC_NAME = "shm03";
this.SH_MASK_04_MC_NAME = "shm04";
this.PAGES_SH_MC_NAME = "s12";
this.PAGES_SHM_MC_NAME = "shm12";
this.STATIC_SHADOW_MC_NAME = "shStatic";
this.PAGE01_DEPTH = 8;
this.PAGE02_DEPTH = 5;
this.PAGE03_DEPTH = 4;
this.PAGE04_DEPTH = 0;
this.SH12_SCALE = 0.4;
this.SH3_SCALE = 1.6;
this.SPEED_DIV = 10;
}
function FFlippingBookBroker()
{
this.objects = new Array();
}
function FFlippingBookCache(broker, usePreloader, cachePages, loadOnDemand, bgColor)
{
this._broker = broker;
this._const = new FFlippingBookConstants();
this._broker.registerObject(this._const.CACHE_OBJ_ID,this);
this._baseObject = this._broker.objects[this._const.MAIN_OBJ_ID];
this._pagesDepth = this._const.CACHE_DEPTH;
this.usePreloader = usePreloader;
this.cachePages = cachePages;
this.loadOnDemand = loadOnDemand;
this.bgColor = bgColor;
this.__pagesLinks = new Array();
this.__pagesProcess = new Array();
this.__pagesHolders = new Array();
this.__pagesLoaders = new Array();
this.__pagesTimeouts = new Array();
this.__pagesLoading = new Array();
this.__pagesExt = new Array();
this.__pagesDepths = new Array();
this.__pagesBacks = new Array();
this.__pagesMasks = new Array();
this.__checkCompleted = new Array();
this.__pagesShadows1 = new Array();
this.__pagesShadows2 = new Array();
this._sound = new Sound(this._baseObject);
this._isSound = true;
this._soundTimeout = this._const.MEDIA_TIMEOUT;
this.sd = this._baseObject.shadowsDepth;
this._mediaComplete = false;
this._soundComplete = false;
this._pagesComplete = false;
this.extXML = new XML();
this.extXML.ignoreWhite = true;
this.extXML._parentObj = this;
this.extXML.onLoad = this.onXMLComplete;
}
function FFlippingBookModel(pagesSet, firstPage, alwaysOpened, broker)
{
this._broker = broker;
this._const = new FFlippingBookConstants();
this._broker.registerObject(this._const.MODEL_OBJ_ID,this);
this._cache = this._broker.objects[this._const.CACHE_OBJ_ID];
this._baseObj = this._broker.objects[this._const.MAIN_OBJ_ID];
this._userPages = pagesSet;
this._curPageNumbers = new Array(4);
this._markEqual();
this._realPages = this._copyArray(pagesSet);
this.alwaysOpened = alwaysOpened;
this.__direction = -1;
this._makeItReal();
this.addProperty("_userCurrentPage2",this.getUserCurrentPage2,null);
this._userCurrentPage = firstPage;
this._currentPage = this._realPageNumber(firstPage);
}
function FFlippingBookClass()
{
this._constants = new FFlippingBookConstants();
this._broker = new FFlippingBookBroker();
this._broker.registerObject(this._constants.MAIN_OBJ_ID,this);
this._cache = new FFlippingBookCache(this._broker,this.usePreloader,this.cachePages,this.loadOnDemand,this.pageBack);
this.addProperty("enabledProp",this.getEnabledProp,this.setEnabledProp);
this.addProperty("pagesNumberProp",this.getPagesNumberProp,null);
this.addProperty("autoFlipProp",this.getAutoFlipProp,this.setAutoFlipProp);
this.addProperty("flipOnClickProp",this.getFlipOnClick,this.setFlipOnClick);
this.addProperty("moveSpeedProp",this.getMoveSpeedProp,this.setMoveSpeedProp);
this.addProperty("closeSpeedProp",this.getCloseSpeedProp,this.setCloseSpeedProp);
this.addProperty("gotoSpeedProp",this.getGotoSpeedProp,this.setGotoSpeedProp);
this.addProperty("alwaysOpenedProp",this.getAlwaysOpenedProp,null);
this.EnabledProp = true;
this._a = Math.abs(this._rotation / 180 * 3.141592653589793);
this._sina = Math.sin(this._a);
this._cosa = Math.cos(this._a);
this._W = this._width;
this._H = this._height;
this._w = (this._H * this._sina - this._W * this._cosa) / (this._sina * this._sina - this._cosa * this._cosa);
this._h = (this._H * this._cosa - this._W * this._sina) / (this._cosa * this._cosa - this._sina * this._sina);
this.setSize(this._w,this._h);
this.box_mc._visible = false;
if(this.extXML != "")
{
this._cache.loadExternalXML(this.extXML);
}
else
{
this._getMedia();
}
}
function FFlippingBookView(bw, bh, autoFlip, flipOnClick, broker)
{
this._const = new FFlippingBookConstants();
this._end = false;
this._broker = broker;
this._broker.registerObject(this._const.VIEW_OBJ_ID,this);
this._baseObj = this._broker.objects[this._const.MAIN_OBJ_ID];
this._cache = this._broker.objects[this._const.CACHE_OBJ_ID];
this._model = this._broker.objects[this._const.MODEL_OBJ_ID];
this._pageWidth = this._baseObj._bookWidth / 2;
this._pageHeight = this._baseObj._bookHeight;
this._autoFlip = this._baseObj.autoFlip;
this._flipOnClick = this._baseObj.flipOnClick;
this._pageSpeed = this._baseObj.moveSpeed / this._const.SPEED_DIV;
this._closeSpeed = this._baseObj.closeSpeed / this._const.SPEED_DIV;
this._gotoSpeed = this._baseObj.gotoSpeed / this._const.SPEED_DIV;
this._minOffset = this._const.MIN_PAGE_OFFSET;
this._flipSound = this._cache._sound;
this._bookState = this._const.INIT_STATE;
this._depth = this._const.BOOK_DEPTH;
this.radIndex = 57.29577951308232;
this._transpPage = 0;
this.__ox = 0;
this.__oy = 0;
this.__oldX = 0;
this.__oldY = 0;
this.__p4Empty = false;
this.__shadowHeight = 2 * Math.sqrt(this._pageHeight * this._pageHeight + this._pageWidth * this._pageWidth);
this.__pagesShadowHeight = 2 * Math.sqrt(4 * this._pageHeight * this._pageHeight + this._pageWidth * this._pageWidth);
this._radIndex = 57.29577951308232;
this.__gotoPageIndex = 0;
this.sd = this._baseObj.shadowsDepth;
this._drawBook();
this._baseObj.onMouseDown = this.__onMouseDown;
this._baseObj.onMouseUp = this.__onMouseUp;
this._baseObj.onEnterFrame = this.__onEnterFrame;
this._model.putPage();
}
FFlippingBookBroker.prototype.registerObject = function(id, obj)
{
this.objects[id] = obj;
};
FFlippingBookCache.prototype._stripItem = function(str)
{
var _loc2_ = str.indexOf(this._const.DELIMITER) + this._const.DELIMITER.length;
return str.substr(_loc2_);
};
FFlippingBookCache.prototype.loadExternalXML = function(src)
{
if(src != "")
{
this.extXML.load(src);
}
else
{
this._baseObject._onXMLComplete(false);
}
};
FFlippingBookCache.prototype.onXMLComplete = function(success)
{
if(success && this.status == 0)
{
this._parentObj._baseObject._onXMLComplete();
}
else if(this.status != 0)
{
trace(this._parentObj._const.INVALID_XML_MSG);
}
};
FFlippingBookCache.prototype.loadMedia = function(pagesSet, flipSound, pageBack, w, h)
{
this._soundSrc = flipSound;
this._bgColor = pageBack;
this._realPages = pagesSet;
this._pageWidth = w / 2;
this._pageHeight = h;
this._loadFlipSound();
this._loadPages();
this._mediaInterval = setInterval(this.__checkMedia,this._const.MEDIA_INTERVAL,this);
};
FFlippingBookCache.prototype._loadFlipSound = function()
{
this._soundComplete = false;
if(this._soundSrc == this._const.DEF_NO_SOUND)
{
this._isSound = false;
this._soundComplete = true;
}
else
{
this._sound.attachSound(this._soundSrc);
if(this._sound.duration == undefined)
{
this._sound.loadSound(this._soundSrc,false);
}
this._soundComplete = false;
this._isSound = false;
}
};
FFlippingBookCache.prototype.__checkMedia = function(obj)
{
if(!obj._soundComplete)
{
if(obj._sound.getBytesLoaded() == obj._sound.getBytesTotal() || obj._sound.getBytesTotal() == undefined)
{
if(obj._sound.getBytesTotal == 0 && obj._soundTimeout > 0)
{
obj._soundTimeout -= obj._const.MEDIA_INTERVAL;
}
else if(obj._sound.getBytesTotal == undefined && obj._soundTimeout <= 0)
{
obj._isSound = false;
obj._soundComplete = true;
}
else
{
obj._isSound = true;
obj._soundComplete = true;
}
}
}
if(!obj._pagesComplete && !obj.loadOnDemand)
{
obj._pagesComplete = true;
for(src in obj.__pagesProcess)
{
if(obj.__pagesProcess[src] < 100 || obj.__checkCompleted[src] == 1 || isNaN(obj.__pagesProcess[src]))
{
var _loc2_ = obj.__pagesHolders[src].getBytesLoaded() / obj.__pagesHolders[src].getBytesTotal() * 100;
if(obj.usePreloader)
{
obj.__pagesLoaders[src]._xscale = _loc2_;
}
obj.__pagesProcess[src] = _loc2_;
obj.__pagesTimeouts[src] -= obj._const.MEDIA_INTERVAL;
if(_loc2_ == 100 && obj.__pagesHolders[src].getBytesLoaded() > 4 && obj.__checkCompleted[src] == 1)
{
obj.__pagesLoaders[src]._parent.removeMovieClip();
obj.__pagesHolders[src]._width = obj._pageWidth;
obj.__pagesHolders[src]._height = obj._pageHeight;
obj.__pagesHolders[src]._parent._visible = true;
obj.__pagesProcess[src] = _loc2_;
if(obj._model == undefined)
{
obj._model = obj._broker.objects[obj._const.MODEL_OBJ_ID];
}
obj._baseObject.onPageLoad(obj._stripItem(src));
}
else
{
obj._pagesComplete = false;
}
if(_loc2_ == 100 && obj.__pagesHolders[src].getBytesLoaded() > 4)
{
obj.__checkCompleted[src] = 1;
}
}
}
}
if(obj._soundComplete && (obj._pagesComplete || obj.loadOnDemand))
{
clearInterval(obj._mediaInterval);
obj._baseObject._onMediaComplete();
}
};
FFlippingBookCache.prototype._loadPages = function()
{
var k = this._realPages.length;
var i = 0;
while(i < k)
{
if(this.__pagesLinks[this._realPages[i]] == undefined)
{
this.__pagesLinks[this._realPages[i]] = this.__createPage(this._const.DEF_PAGE_NAME + "_" + i,this._realPages[i]);
this.__pagesLinks[this._realPages[i]]._x = i * (this._pageWidth + 2);
this.__pagesLinks[this._realPages[i]]._visible = false;
}
i++;
}
for(src in this.__pagesLinks)
{
this.__pagesLoading[src] = false;
var media = this.__pagesHolders[src].attachMovie(this._stripItem(src),this._const.PAGE_MEDIA_NAME,0);
if(media == undefined && src != this._const.TRANSPARENT_PAGE1 && src != this._const.TRANSPARENT_PAGE2 && src != this._const.EMPTY_PAGE)
{
this.__pagesProcess[src] = 0;
this.__pagesExt[src] = true;
this.__pagesTimeouts[src] = this._const.PAGE_TIMEOUT;
if(!this.loadOnDemand)
{
this.__pagesHolders[src]._parent._visible = false;
this.__pagesHolders[src].loadMovie(this._stripItem(src));
}
if(this.usePreloader)
{
var loaderLnk = this.__pagesLinks[src];
this.__placePreloader(loaderLnk);
this.__pagesLoaders[src] = eval(loaderLnk + "." + this._const.PAGE_PRELOADER_NAME + "." + this._const.PRELOADER_BAR_NAME);
}
}
else
{
this.__pagesExt[src] = false;
this.__pagesProcess[src] = 100;
if(this._baseObject.scaleContent)
{
this.__pagesHolders[src]._width = this._pageWidth;
this.__pagesHolders[src]._height = this._pageHeight;
}
else
{
this.__pagesHolders[src].setMask(this.__pagesMasks[src]);
}
}
}
};
FFlippingBookCache.prototype.__createPage = function(src, id)
{
var _loc3_ = this._baseObject.createEmptyMovieClip(src,this._pagesDepth++);
var _loc4_ = _loc3_.createEmptyMovieClip(this._const.PAGE_HOLDER_PARENT_NAME,1);
if(id != this._const.TRANSPARENT_PAGE1 && id != this._const.TRANSPARENT_PAGE2)
{
var _loc5_ = _loc3_.createEmptyMovieClip(this._const.PAGE_BG_NAME,0);
var _loc6_ = _loc3_.createEmptyMovieClip(this._const.PAGE_SHADOW_LAYER_NAME,100);
this.__drawBack(_loc5_);
this.__pagesBacks[id] = _loc5_;
if(id != this._const.EMPTY_PAGE)
{
this.__pagesHolders[id] = _loc4_.createEmptyMovieClip(this._const.PAGE_HOLDER_NAME,0);
this.__pagesProcess[id] = 0;
if(!this._baseObject.scaleContent)
{
this.__pagesMasks[id] = _loc4_.createEmptyMovieClip(this._const.PAGE_MASK_NAME,100);
this.__drawBack(this.__pagesMasks[id]);
}
}
else
{
this.__pagesProcess[id] = 100;
}
var _loc0_ = null;
var _loc8_ = this.__pagesShadows1[id] = _loc6_.createEmptyMovieClip(this._const.PAGE_STATIC_SHADOW1_NAME,10);
var _loc0_ = null;
var _loc7_ = this.__pagesShadows2[id] = _loc6_.createEmptyMovieClip(this._const.PAGE_STATIC_SHADOW2_NAME,11);
this.__drawStaticShadows(_loc8_,_loc7_);
}
else
{
this.__pagesHolders[id] = 100;
}
return _loc3_;
};
FFlippingBookCache.prototype.__drawStaticShadows = function(mc1, mc2)
{
var pw = this._pageWidth;
var sw = pw / 3;
var sh = this._pageHeight;
var colors = [0,0];
var ratios = [0,255];
var alphas = [0,20 * this.sd];
var matrix = {matrixType:"box",x:pw - sw,y:0,w:sw,h:sh,r:0};
with(mc1)
{
moveTo(pw - sw,0);
beginGradientFill("linear",colors,alphas,ratios,matrix);
lineTo(pw,0);
lineTo(pw,sh);
lineTo(pw - sw,sh);
lineTo(pw - sw,0);
endFill();
}
colors = [0,0];
ratios = [0,255];
alphas = [20 * this.sd,0];
matrix = {matrixType:"box",x:0,y:0,w:sw,h:sh,r:0};
with(mc2)
{
moveTo(0,0);
beginGradientFill("linear",colors,alphas,ratios,matrix);
lineTo(sw,0);
lineTo(sw,sh);
lineTo(0,sh);
lineTo(0,0);
endFill();
}
};
FFlippingBookCache.prototype.__placePreloader = function(mc)
{
var _loc2_ = mc.attachMovie(this._const.SYMBOL_PRELOADER_NAME,this._const.PAGE_PRELOADER_NAME,2);
var _loc4_ = this._pageWidth / 2;
var _loc3_ = this._pageHeight / 2;
_loc2_._width = this._pageWidth / this._const.PRELOADER_WIDTH_SCALE;
_loc2_._height = this._pageHeight / this._const.PRELOADER_HEIGHT_SCALE;
_loc2_._x = _loc4_ - _loc2_._width / 2;
_loc2_._y = _loc3_ - _loc2_._height / 2;
_loc2_.bar_mc._xscale = 0;
};
FFlippingBookCache.prototype.__drawBack = function(mc)
{
trace(mc);
with(mc)
{
moveTo(0,0);
beginFill(this.bgColor,100);
lineTo(this._pageWidth,0);
lineTo(this._pageWidth,this._pageHeight);
lineTo(0,this._pageHeight);
lineTo(0,0);
endFill();
}
};
FFlippingBookCache.prototype.getPage = function(src)
{
var _loc3_ = this.__pagesLinks[src];
if(!this.loadOnDemand)
{
return _loc3_;
}
if(this.__pagesProcess[src] == 0 || !this.cachePages && this.__pagesExt[src] && this.__pagesProcess[src] == 100)
{
this.__pagesTimeouts[src] = this._const.PAGE_TIMEOUT;
this.__pagesHolders[src]._parent._visible = false;
this.__pagesHolders[src].loadMovie(this._stripItem(src));
this.__pagesLoading[src] = true;
if(!this.cachePages)
{
this.__pagesLoaders[src]._parent._visible = true;
}
if(this._pagesInterval == undefined)
{
this._pagesInterval = setInterval(this.__checkPages,this._const.MEDIA_INTERVAL,this);
}
}
return _loc3_;
};
FFlippingBookCache.prototype.__checkPages = function(obj)
{
var _loc3_ = true;
for(src in obj.__pagesLoading)
{
if(obj.__pagesLoading[src])
{
var _loc2_ = obj.__pagesHolders[src].getBytesLoaded() / obj.__pagesHolders[src].getBytesTotal() * 100;
if(obj.usePreloader)
{
obj.__pagesLoaders[src]._xscale = _loc2_;
}
obj.__pagesTimeouts[src] -= obj._const.MEDIA_INTERVAL;
obj.__pagesProcess[src] = _loc2_;
if(_loc2_ == 100 && obj.__pagesHolders[src].getBytesLoaded() > 4 && obj.__checkCompleted[src] == 1 && !isNaN(_loc2_))
{
if(obj.cachePages)
{
obj.__pagesLoaders[src]._parent.removeMovieClip();
obj.__pagesProcess[src] = 100;
}
else
{
obj.__pagesLoaders[src]._parent._visible = false;
obj.__pagesLoaders[src]._xscale = 0;
obj.__checkCompleted[src] = undefined;
}
if(obj._baseObject.scaleContent)
{
obj.__pagesHolders[src]._width = obj._pageWidth;
obj.__pagesHolders[src]._height = obj._pageHeight;
}
else
{
obj.__pagesHolders[src].setMask(obj.__pagesMasks[src]);
}
obj.__pagesHolders[src]._parent._visible = true;
obj.__pagesLoading[src] = false;
if(obj._model == undefined)
{
obj._model = obj._broker.objects[obj._const.MODEL_OBJ_ID];
}
obj._baseObject.onPageLoad(obj._stripItem(src));
}
else
{
_loc3_ = false;
}
if(_loc2_ == 100 && obj.__pagesHolders[src].getBytesLoaded() > 4)
{
obj.__checkCompleted[src] = 1;
}
}
}
if(_loc3_)
{
clearInterval(obj._pagesInterval);
obj._pagesInterval = undefined;
}
};
FFlippingBookCache.prototype.setPage = function(page, src, i, pageNum, dir)
{
if(this._baseObject.loadOnDemand)
{
if(i == 1 || i == 3)
{
var _loc12_ = 4;
var _loc2_ = new Array();
var _loc4_ = new Array();
var _loc3_ = 0;
while(_loc3_ < _loc12_)
{
if(dir == 1)
{
_loc2_[_loc3_] = pageNum + _loc3_ + 2;
_loc4_[_loc3_] = pageNum - _loc3_ - 3;
}
else if(dir == -1)
{
_loc2_[2 * _loc3_] = pageNum + _loc3_ + 2;
_loc2_[2 * _loc3_ + 1] = pageNum - _loc3_ - 1;
}
else
{
_loc2_[_loc3_] = pageNum - _loc3_ - 1;
_loc4_[_loc3_] = pageNum + _loc3_ + 4;
}
_loc3_ = _loc3_ + 1;
}
var _loc9_ = this._baseObject._model._realPages.length;
_loc3_ = 0;
while(_loc3_ < _loc2_.length)
{
if(_loc2_[_loc3_] > 0 && _loc2_[_loc3_] < _loc9_)
{
var _loc6_ = this._baseObject._model._realPages[_loc2_[_loc3_]];
if(this.__pagesExt[_loc6_] && this.__pagesProcess[_loc6_] == 0)
{
this.getPage(_loc6_);
}
}
_loc3_ = _loc3_ + 1;
}
_loc3_ = 0;
while(_loc3_ < _loc4_.length)
{
if(_loc4_[_loc3_] > 0 && _loc4_[_loc3_] < _loc9_)
{
_loc6_ = this._baseObject._model._realPages[_loc4_[_loc3_]];
if(this.__pagesExt[_loc6_] && this.__pagesProcess[_loc6_] != 0 && i == 1)
{
this.__pagesProcess[_loc6_] = 0;
unloadMovie(this.__pagesHolders[_loc6_]);
}
}
_loc3_ = _loc3_ + 1;
}
}
}
if(this._view == undefined)
{
this._view = this._broker.objects[this._const.VIEW_OBJ_ID];
}
var _loc10_ = this.getPage(src);
var _loc13_ = page;
this.__pagesDepths[i] = _loc10_.getDepth();
_loc13_.swapDepths(_loc10_);
_loc10_._x = _loc13_._x;
_loc10_._y = _loc13_._y;
_loc10_._rotation = _loc13_._rotation;
_loc13_._visible = false;
if(i < 3)
{
_loc10_._visible = true;
}
if((i == 1 || i == 2) && (src == this._const.TRANSPARENT_PAGE1 || src == this._const.TRANSPARENT_PAGE2))
{
this._view._transpPage = i;
}
if(i == 4 && (src == this._const.TRANSPARENT_PAGE1 || src == this._const.TRANSPARENT_PAGE2))
{
this._view._transpPage04 = true;
}
else
{
this._view._transpPage04 = false;
}
switch(i)
{
case 1:
this._view.__page01 = _loc10_;
this.__pagesShadows1[src]._visible = true;
this.__pagesShadows2[src]._visible = false;
break;
case 2:
this._view.__page02 = _loc10_;
this.__pagesShadows1[src]._visible = false;
this.__pagesShadows2[src]._visible = true;
break;
case 3:
this._view.__page03 = _loc10_;
if(this._view.__ox > 0)
{
this.__pagesShadows1[src]._visible = true;
this.__pagesShadows2[src]._visible = false;
}
else
{
this.__pagesShadows1[src]._visible = false;
this.__pagesShadows2[src]._visible = true;
}
break;
case 4:
this._view.__page04 = _loc10_;
if(this._view.__ox < 0)
{
this.__pagesShadows1[src]._visible = true;
this.__pagesShadows2[src]._visible = false;
}
else
{
this.__pagesShadows1[src]._visible = false;
this.__pagesShadows2[src]._visible = true;
}
}
};
FFlippingBookCache.prototype.setSize = function(w, h)
{
for(link in this.__pagesLinks)
{
this.__pagesLinks[link]._width = w / 2;
this.__pagesLinks[link]._height = h;
}
};
FFlippingBookCache.prototype.restoreDirectGotoPages = function()
{
this._view.__page01.setMask(null);
this._view.__page02.setMask(null);
this._view.__mask12.clear();
this._view.__page01._visible = false;
this._view.__page02._visible = false;
this._view.__page01.swapDepths(this.__pagesDepths[1]);
this._view.__page02.swapDepths(this.__pagesDepths[2]);
this._view.__page01 = this._view.tmp01;
this._view.__page02 = this._view.tmp02;
this._view._transpPage = 0;
};
FFlippingBookCache.prototype.restorePages = function()
{
this._view.__page01.setMask(null);
this._view.__page02.setMask(null);
this._view.__page03.setMask(null);
this._view.__page04.setMask(null);
this._view.__mask03.clear();
this._view.__mask12.clear();
this._view.__page01._visible = false;
this._view.__page02._visible = false;
this._view.__page01.swapDepths(this.__pagesDepths[1]);
this._view.__page02.swapDepths(this.__pagesDepths[2]);
this._view.__page03.swapDepths(this.__pagesDepths[3]);
this._view.__page04.swapDepths(this.__pagesDepths[4]);
this._view.__page03._x = - this._view._pageWidth;
this._view.__page03._y = (- this._view._pageHeight) / 2;
this._view.__page03._rotation = 0;
this._view.__page04._x = 0;
this._view.__page04._y = (- this._view._pageHeight) / 2;
this._view.__page04._rotation = 0;
this._view.__page01 = this._view.tmp01;
this._view.__page02 = this._view.tmp02;
this._view.__page03 = this._view.tmp03;
this._view.__page04 = this._view.tmp04;
this._view._transpPage = 0;
};
FFlippingBookCache.prototype.restoreWorkPages = function()
{
this._view.__page01.setMask(null);
this._view.__page02.setMask(null);
this._view.__mask03.clear();
this._view.__mask12.clear();
this._view._drawShadow12();
this._view._drawShadow03();
this._view._drawShadow04();
this._view.__page03._visible = false;
this._view.__page04._visible = false;
this._view.__page03.swapDepths(this.__pagesDepths[3]);
this._view.__page04.swapDepths(this.__pagesDepths[4]);
this._view.__page03._x = - this._view._pageWidth;
this._view.__page03._y = (- this._view._pageHeight) / 2;
this._view.__page03._rotation = 0;
this._view.__page04._x = 0;
this._view.__page04._y = (- this._view._pageHeight) / 2;
this._view.__page04._rotation = 0;
this._view.__page03 = this._view.tmp03;
this._view.__page04 = this._view.tmp04;
};
FFlippingBookModel.prototype.getUserPageNumber = function(src)
{
var _loc4_ = this._userPages.length;
var _loc2_ = 0;
while(_loc2_ < _loc4_)
{
var _loc3_ = this._userPages[_loc2_];
if(_loc3_ == src)
{
return _loc2_;
}
_loc2_ = _loc2_ + 1;
}
};
FFlippingBookModel.prototype._markEqual = function()
{
var _loc10_ = this._const.DELIMITER;
var _loc7_ = this._userPages.length;
var _loc5_ = new Array(_loc7_);
var _loc6_ = 0;
while(_loc6_ < _loc7_)
{
_loc5_[_loc6_] = false;
_loc6_ = _loc6_ + 1;
}
var _loc4_ = 0;
while(_loc4_ < _loc7_)
{
var _loc9_ = this._userPages[_loc4_];
var _loc11_ = _loc4_;
var _loc8_ = 0;
var _loc2_ = 0;
while(_loc2_ < _loc7_)
{
var _loc3_ = this._userPages[_loc2_];
if(_loc3_ == _loc9_ && !_loc5_[_loc2_])
{
_loc8_;
this._userPages[_loc2_] = _loc8_++ + _loc10_ + this._userPages[_loc2_];
_loc5_[_loc2_] = true;
}
_loc2_ = _loc2_ + 1;
}
_loc4_ = _loc4_ + 1;
}
};
FFlippingBookModel.prototype.getUserCurrentPage2 = function()
{
var _loc2_ = this._userCurrentPage;
if(this._view.__ox > 0)
{
_loc2_ += 1;
}
return _loc2_;
};
FFlippingBookModel.prototype.__addPage = function(index, pageSrc)
{
this._realPages.splice(index,0,pageSrc);
};
FFlippingBookModel.prototype._copyArray = function(src)
{
var _loc3_ = new Array();
var _loc1_ = 0;
while(_loc1_ < src.length)
{
_loc3_[_loc1_] = src[_loc1_];
_loc1_ = _loc1_ + 1;
}
return _loc3_;
};
FFlippingBookModel.prototype._makeItReal = function()
{
this._realPages = this._copyArray(this._userPages);
var _loc2_ = true;
if(this._realPages.length % 2 == 0)
{
_loc2_ = false;
}
if(_loc2_)
{
this.__addPage(this._realPages.length,this._const.EMPTY_PAGE);
}
if(!this.alwaysOpened)
{
this.__addPage(0,this._const.TRANSPARENT_PAGE1);
this.__addPage(this._realPages.length,this._const.TRANSPARENT_PAGE2);
}
};
FFlippingBookModel.prototype._realPageNumber = function(n)
{
if(n < 0)
{
this._userCurrentPage = n = 0;
}
else if(n >= this._userPages.length)
{
n = this._userPages.length - 1;
if(!this.alwaysOpened && this._userPages.length % 2 != 0)
{
n = n + 1;
}
}
if(!this.alwaysOpened)
{
n = n + 1;
}
if(this._userPages.length == 0)
{
n = 0;
}
if(n % 2 != 0)
{
n = n - 1;
}
return n;
};
FFlippingBookModel.prototype.putPage = function()
{
if(this._view == undefined)
{
this._view = this._broker.objects[this._const.VIEW_OBJ_ID];
}
var _loc2_ = this.__direction;
this.__direction = -1;
switch(_loc2_)
{
case 0:
this._currentPage -= 2;
this._userCurrentPage -= 2;
break;
case 1:
this._currentPage += 2;
this._userCurrentPage += 2;
}
this._cache.setPage(this._view.__page01,this._realPages[this._currentPage],1,this._currentPage,_loc2_);
this._cache.setPage(this._view.__page02,this._realPages[this._currentPage + 1],2,this._currentPage + 1,_loc2_);
this._curPageNumbers[0] = this.getUserPageNumber(this._realPages[this._currentPage]);
this._curPageNumbers[1] = this.getUserPageNumber(this._realPages[this._currentPage + 1]);
if(this._realPages[this._currentPage] == this._const.EMPTY_PAGE)
{
this._curPageNumbers[0] = this._userPages.length;
}
vsrc = this._baseObj.pagesSet[this._userCurrentPage];
if(_loc2_ == 1)
{
if(this._cache.__pagesExt[vsrc] == true)
{
this._baseObj.onPutPage(this._curPageNumbers[0],this._cache.__pagesHolders[this._userPages[this._curPageNumbers[0]]]);
}
else
{
this._baseObj.onPutPage(this._curPageNumbers[0],this._cache.__pagesHolders[this._userPages[this._curPageNumbers[0]]].media);
}
}
else if(this._cache.__pagesExt[vsrc] == true)
{
this._baseObj.onPutPage(this._curPageNumbers[1],this._cache.__pagesHolders[this._userPages[this._curPageNumbers[1]]]);
}
else
{
this._baseObj.onPutPage(this._curPageNumbers[1],this._cache.__pagesHolders[this._userPages[this._curPageNumbers[1]]].media);
}
this._view.onSetPages(1,2);
if(this._currentPage + 2 > this._realPages.length - 1)
{
this._baseObj.onLastPage();
}
else if(this._currentPage - 2 < 0)
{
this._baseObj.onFirstPage();
}
};
FFlippingBookModel.prototype.goForward = function()
{
if(this._currentPage != this._realPages.length - 2 && this._currentPage >= 0)
{
this._cache.setPage(this._view.__page03,this._realPages[this._currentPage + 2],3,this._currentPage + 2,1);
this._cache.setPage(this._view.__page04,this._realPages[this._currentPage + 3],4,this._currentPage + 3,1);
this._curPageNumbers[2] = this.getUserPageNumber(this._realPages[this._currentPage + 2]);
this._curPageNumbers[3] = this.getUserPageNumber(this._realPages[this._currentPage + 3]);
this.__direction = 1;
}
else
{
this._view._bookState = this._const.UNACTIVE_STATE;
}
};
FFlippingBookModel.prototype.goBack = function()
{
if(this._currentPage > 0)
{
this._cache.setPage(this._view.__page03,this._realPages[this._currentPage - 1],3,this._currentPage - 1,0);
this._cache.setPage(this._view.__page04,this._realPages[this._currentPage - 2],4,this._currentPage - 2,0);
this._curPageNumbers[2] = this.getUserPageNumber(this._realPages[this._currentPage - 1]);
this._curPageNumbers[3] = this.getUserPageNumber(this._realPages[this._currentPage - 2]);
this.__direction = 0;
}
else
{
this._view._bookState = this._const.UNACTIVE_STATE;
}
};
FFlippingBookModel.prototype.getNextGotoPage = function(n)
{
if(this._currentPage > n)
{
this.goBack();
}
else if(this._currentPage < n)
{
this.goForward();
}
else
{
this._baseObj.onEndGoto();
this._view._bookState = this._const.UNACTIVE_STATE;
}
};
FFlippingBookClass.prototype = new MovieClip();
FFlippingBookClass.prototype.getEnabledProp = function()
{
return this.EnabledProp;
};
FFlippingBookClass.prototype.setEnabledProp = function(v)
{
this.EnabledProp = v;
};
FFlippingBookClass.prototype.getPagesNumberProp = function()
{
return this.pagesSet.length;
};
FFlippingBookClass.prototype.getAlwaysOpenedProp = function()
{
return this.alwaysOpened;
};
FFlippingBookClass.prototype.getAutoFlipProp = function()
{
return this.autoFlip;
};
FFlippingBookClass.prototype.setAutoFlipProp = function(v)
{
this.autoFlip = v;
if(this._view != undefined)
{
this._view._autoFlip = v;
}
};
FFlippingBookClass.prototype.getFlipOnClick = function()
{
return this.flipOnClick;
};
FFlippingBookClass.prototype.setFlipOnClick = function(v)
{
this.flipOnClick = v;
if(this._view != undefined)
{
this._view._flipOnClick = v;
}
};
FFlippingBookClass.prototype.getMoveSpeedProp = function()
{
return this.moveSpeed;
};
FFlippingBookClass.prototype.setMoveSpeedProp = function(v)
{
this.moveSpeed = v;
if(this._view != undefined)
{
this._view._pageSpeed = v / this._constants.SPEED_DIV;
}
};
FFlippingBookClass.prototype.getCloseSpeedProp = function()
{
return this.closeSpeed;
};
FFlippingBookClass.prototype.setCloseSpeedProp = function(v)
{
this.closeSpeed = v;
if(this._view != undefined)
{
this._view._closeSpeed = v / this._constants.SPEED_DIV;
}
};
FFlippingBookClass.prototype.getGotoSpeedProp = function()
{
return this.gotoSpeed;
};
FFlippingBookClass.prototype.setGotoSpeedProp = function(v)
{
this.gotoSpeed = v;
if(this._view != undefined)
{
this._view._gotoSpeed = v / this._constants.SPEED_DIV;
}
};
FFlippingBookClass.prototype.flipForward = function()
{
if(this._view != undefined)
{
var _loc2_ = this._model._currentPage + 2;
this._view.gotoPage(_loc2_);
}
};
FFlippingBookClass.prototype.flipBack = function()
{
if(this._view != undefined)
{
var _loc2_ = this._model._currentPage - 2;
this._view.gotoPage(_loc2_);
}
};
FFlippingBookClass.prototype.setSize = function(w, h)
{
this._bookWidth = w;
this._bookHeight = h;
this._xscale = 100;
this._yscale = 100;
if(this._view != undefined && (this._view._bookState == this._constants.UNACTIVE_STATE || this._view._bookState == this._constants.INIT_STATE))
{
this._view.setSize(w,h);
this._cache.setSize(w,h);
}
};
FFlippingBookClass.prototype._onXMLComplete = function()
{
this._initFromCachedXML();
this._getMedia();
};
FFlippingBookClass.prototype._getMedia = function()
{
this._model = new FFlippingBookModel(this.pagesSet,this.firstPage,this.alwaysOpened,this._broker);
this._cache.loadMedia(this._model._realPages,this.flipSound,this.pageBack,this._bookWidth,this._bookHeight);
};
FFlippingBookClass.prototype._onMediaComplete = function()
{
if(this._model._userPages.length > 0)
{
this._view = new FFlippingBookView(this._bookWidth,this._bookHeight,this.autoFlip,this.flipOnClick,this._broker);
}
};
FFlippingBookClass.prototype._initFromCachedXML = function()
{
var _loc8_ = this._cache.extXML;
var _loc9_ = _loc8_.firstChild;
var _loc3_ = _loc9_.childNodes;
var _loc2_ = 0;
while(_loc3_[_loc2_])
{
var _loc7_ = _loc3_[_loc2_].nodeName.toUpperCase();
switch(_loc7_)
{
case this._constants.WIDTH_NODE_NAME:
this._bookWidth = _loc3_[_loc2_].firstChild.nodeValue;
break;
case this._constants.HEIGHT_NODE_NAME:
this._bookHeight = _loc3_[_loc2_].firstChild.nodeValue;
break;
case this._constants.FIRST_PAGE_NODE_NAME:
this.firstPage = _loc3_[_loc2_].firstChild.nodeValue;
break;
case this._constants.ALWAYS_OPENED_NODE_NAME:
this.alwaysOpened = _loc3_[_loc2_].firstChild.nodeValue;
break;
case this._constants.AUTOFLIP_NODE_NAME:
this.autoFlip = _loc3_[_loc2_].firstChild.nodeValue;
break;
case this._constants.FLIP_ON_CLICK_NODE_NAME:
this.flipOnClick = _loc3_[_loc2_].firstChild.nodeValue;
break;
case this._constants.SCALE_CONTENT_NODE_NAME:
this.scaleContent = _loc3_[_loc2_].firstChild.nodeValue;
break;
case this._constants.MOVE_SPEED_NODE_NAME:
this.moveSpeed = _loc3_[_loc2_].firstChild.nodeValue;
break;
case this._constants.CLOSE_SPEED_NODE_NAME:
this.closeSpeed = _loc3_[_loc2_].firstChild.nodeValue;
break;
case this._constants.GOTO_SPEED_NODE_NAME:
this.gotoSpeed = _loc3_[_loc2_].firstChild.nodeValue;
break;
case this._constants.FLIP_SOUND_NODE_NAME:
this.flipSound = this._removeWhite(_loc3_[_loc2_].firstChild.nodeValue);
break;
case this._constants.PAGE_BACK_NODE_NAME:
this.pageBack = _loc3_[_loc2_].firstChild.nodeValue;
break;
case this._constants.LOAD_ON_DEMAND_NODE_NAME:
this.loadOnDemand = _loc3_[_loc2_].firstChild.nodeValue;
break;
case this._constants.CACHE_PAGES_NODE_NAME:
this.cachePages = _loc3_[_loc2_].firstChild.nodeValue;
break;
case this._constants.USE_PRELOADER_NODE_NAME:
this.usePreloader = _loc3_[_loc2_].firstChild.nodeValue;
break;
case this._constants.SHADOWS_DEPTH_NODE_NAME:
this.shadowsDepth = _loc3_[_loc2_].firstChild.nodeValue;
break;
case this._constants.PAGES_NODE_NAME:
var _loc4_ = 0;
var _loc5_ = _loc3_[_loc2_].childNodes;
this.pagesSet = new Array();
this.aniSwf = new Array();
while(_loc5_[_loc4_])
{
var _loc6_ = this._removeWhite(_loc5_[_loc4_].firstChild.nodeValue);
this.pagesSet.push(_loc6_);
this.aniSwf.push(_loc5_[_loc4_].attributes.ani_swf);
_loc4_ = _loc4_ + 1;
}
}
_loc2_ = _loc2_ + 1;
}
this._validateParameters();
};
FFlippingBookClass.prototype._removeWhite = function(str)
{
var _loc3_ = new String();
var _loc4_ = str.length;
var _loc6_ = 0;
var _loc1_ = 0;
while(_loc1_ < _loc4_)
{
var _loc2_ = str.charAt(_loc1_);
if(_loc2_ != " ")
{
_loc3_ += _loc2_;
}
_loc1_ = _loc1_ + 1;
}
return _loc3_;
};
FFlippingBookClass.prototype._validateNumber = function(param, min, max, def)
{
if(typeof param != this._constants.NUM_TYPE_NAME)
{
param = this._removeWhite(param);
if(!isNaN(Number(param)))
{
param = Number(param);
}
else
{
param = def;
}
}
if(param > max)
{
param = max;
}
if(param < min)
{
param = min;
}
return param;
};
FFlippingBookClass.prototype._validateBoolean = function(param, def)
{
if(typeof param != this._constants.BOOL_TYPE_NAME)
{
param = param.toUpperCase();
if(param.indexOf(this._constants.BOOL_TRUE_VAL) != -1)
{
param = true;
}
else if(param.indexOf(this._constants.BOOL_FALSE_VAL) != -1)
{
param = false;
}
else
{
param = def;
}
}
return param;
};
FFlippingBookClass.prototype._validateColor = function(param)
{
param = this._removeWhite(param);
if(param < 0 || param > 16777215)
{
param = this._constants.DEF_PAGEBACK;
}
return param;
};
FFlippingBookClass.prototype._validateParameters = function()
{
this._bookWidth = this._validateNumber(this._bookWidth,0,Infinity,this._constants.DEF_WIDTH);
this._bookHeight = this._validateNumber(this._bookHeight,0,Infinity,this._constants.DEF_HEIGHT);
this.firstPage = this._validateNumber(this.firstPage,0,Infinity,this._constants.DEF_FIRST_PAGE);
this.moveSpeed = this._validateNumber(this.moveSpeed,0,Infinity,this._constants.DEF_MOVE_SPEED);
this.closeSpeed = this._validateNumber(this.closeSpeed,0,Infinity,this._constants.DEF_CLOSE_SPEED);
this.gotoSpeed = this._validateNumber(this.gotoSpeed,0,Infinity,this._constants.DEF_GOTO_SPEED);
this.autoFlip = this._validateNumber(this.autoFlip,0,Infinity,this._constants.DEF_AUTOFLIP);
this._cache.sd = this.shadowsDepth = this._validateNumber(this.shadowsDepth,0,Infinity,this._constants.DEF_SHADOWS_DEPTH);
this.pageBack = this._validateColor(this.pageBack);
this.alwaysOpened = this._validateBoolean(this.alwaysOpened,this._constants.DEF_ALWAYS_OPENED);
this.flipOnClick = this._validateBoolean(this.flipOnClick,this._constants.DEF_FLIP_ON_CLICK);
this.loadOnDemand = this._validateBoolean(this.loadOnDemand,this._constants.DEF_LOAD_ON_DEMAND);
this.cachePages = this._validateBoolean(this.cachePages,this._constants.DEF_CACHE_PAGES);
this.usePreloader = this._validateBoolean(this.usePreloader,this._constants.DEF_USE_PRELOADER);
this.scaleContent = this._validateBoolean(this.scaleContent,this._constants.DEF_SCALE_CONTENT);
this._cache.usePreloader = this.usePreloader;
this._cache.cachePages = this.cachePages;
this._cache.loadOnDemand = this.loadOnDemand;
this._cache.bgColor = this.pageBack;
};
FFlippingBookClass.prototype.gotoPage = function(i)
{
if(this._view != undefined)
{
this._view.gotoPage(i);
}
};
FFlippingBookClass.prototype.directGotoPage = function(i)
{
if(this._view != undefined)
{
this._view.directGotoPage(i);
}
};
FFlippingBookView.prototype.setSize = function(w, h)
{
this._pageWidth = w / 2;
this._pageHeight = h;
this.tmp01._x = this.__page01._x = - this._pageWidth;
this.tmp01._y = this.__page01._y = (- this._pageHeight) / 2;
this.tmp02._x = this.__page02._x = 0;
this.tmp02._y = this.__page02._y = (- this._pageHeight) / 2;
this.tmp03._y = this.__page03._y = (- this._pageHeight) / 2;
this.tmp04._y = this.__page04._y = (- this._pageHeight) / 2;
this.__pagesShadowMask._x = - this._pageWidth;
this.__pagesShadowMask._y = (- this._pageHeight) / 2;
this.__mask03._y = (- this._pageHeight) / 2;
this.__mask12._y = (- this._pageHeight) / 2;
this.__shMask03._y = (- this._pageHeight) / 2;
this.__shMask04._y = (- this._pageHeight) / 2;
this._drawShadow12();
this._drawShadow03();
this._drawShadow04();
};
FFlippingBookView.prototype._drawBook = function()
{
this.__page04 = this.tmp04 = this._baseObj.createEmptyMovieClip(this._const.PAGE_04_MC_NAME,this._depth++);
this.__shadow04 = this._baseObj.createEmptyMovieClip(this._const.SHADOW_04_MC_NAME,this._depth++);
this.__shMask04 = this._baseObj.createEmptyMovieClip(this._const.SH_MASK_04_MC_NAME,this._depth++);
this.__page01 = this.tmp01 = this._baseObj.createEmptyMovieClip(this._const.PAGE_01_MC_NAME,this._depth++);
this.__page02 = this.tmp02 = this._baseObj.createEmptyMovieClip(this._const.PAGE_02_MC_NAME,this._depth++);
this.__staticShadow = this._baseObj.createEmptyMovieClip(this._const.STATIC_SHADOW_MC_NAME,this._depth++);
this.__pagesShadow = this._baseObj.createEmptyMovieClip(this._const.PAGES_SH_MC_NAME,this._depth++);
this.__pagesShadowMask = this._baseObj.createEmptyMovieClip(this._const.PAGES_SHM_MC_NAME,this._depth++);
this.__mask12 = this._baseObj.createEmptyMovieClip(this._const.MASK_12_MC_NAME,this._depth++);
this.__page03 = this.tmp03 = this._baseObj.createEmptyMovieClip(this._const.PAGE_03_MC_NAME,this._depth++);
this.__mask03 = this._baseObj.createEmptyMovieClip(this._const.MASK_03_MC_NAME,this._depth++);
this.__page03.setMask(this.__mask03);
this.__shadow03 = this._baseObj.createEmptyMovieClip(this._const.SHADOW_03_MC_NAME,this._depth++);
this.__shMask03 = this._baseObj.createEmptyMovieClip(this._const.SH_MASK_03_MC_NAME,this._depth++);
this.__page01._x = - this._pageWidth;
this.__page01._y = (- this._pageHeight) / 2;
this.__page02._x = 0;
this.__page02._y = (- this._pageHeight) / 2;
this.__page03._y = (- this._pageHeight) / 2;
this.__page04._y = (- this._pageHeight) / 2;
this.__pagesShadowMask._x = - this._pageWidth;
this.__pagesShadowMask._y = (- this._pageHeight) / 2;
this.__mask03._y = (- this._pageHeight) / 2;
this.__mask12._y = (- this._pageHeight) / 2;
this.__shMask03._y = (- this._pageHeight) / 2;
this.__shMask04._y = (- this._pageHeight) / 2;
this._drawShadow12();
this._drawShadow03();
this._drawShadow04();
};
FFlippingBookView.prototype.__redrawBook = function()
{
this.__drawShadow03();
this.__mask03._x = 0;
this.__drawShadow04();
this.__mask12._x = 0;
this._drawShadow12();
};
FFlippingBookView.prototype._drawShadow12 = function()
{
this.__pagesShadow._x = 0;
this.__pagesShadow._y = 0;
this.__pagesShadow.clear();
var sw = this._const.SH12_SCALE * this._pageWidth;
var sh = this.__pagesShadowHeight;
var colors = [0,0];
var ratios = [0,255];
var alphas = [0,25 * this.sd];
var matrix = {matrixType:"box",x:- sw,y:(- sh) / 2,w:sw,h:sh,r:0};
with(this.__pagesShadow)
{
moveTo(- sw,(- sh) / 2);
beginGradientFill("linear",colors,alphas,ratios,matrix);
lineTo(0,(- sh) / 2);
lineTo(0,sh / 2);
lineTo(- sw,sh / 2);
lineTo(- sw,(- sh) / 2);
endFill();
}
this.__pagesShadow._visible = false;
};
FFlippingBookView.prototype.__drawShadow12Mask = function()
{
this.__pagesShadowMask.clear();
var ax = 0;
var ay = this._pageHeight;
var bx = 0;
var by = 0;
var cx = 2 * this._pageWidth;
var cy = 0;
var dx = 2 * this._pageWidth;
var dy = this._pageHeight;
if(this._transpPage == 1)
{
ax += this._pageWidth;
bx += this._pageWidth;
}
else if(this._transpPage == 2)
{
cx -= this._pageWidth;
dx -= this._pageWidth;
}
with(this.__pagesShadowMask)
{
moveTo(ax,ay);
beginFill(0,100);
lineTo(bx,by);
lineTo(cx,cy);
lineTo(dx,dy);
lineTo(ax,ay);
endFill();
}
this.__pagesShadow.setMask(this.__pagesShadowMask);
};
FFlippingBookView.prototype._drawShadow03 = function()
{
this.__shadow03._x = 0;
this.__shadow03._y = 0;
this.__shadow03.clear();
var sw = this._const.SH3_SCALE * this._pageWidth;
var sh = this.__shadowHeight;
var colors = [0,0,0,0];
var ratios = [0,200,242,255];
var alphas = [0,10 * this.sd,20 * this.sd,0];
var matrix = {matrixType:"box",x:- sw,y:(- sh) / 2,w:sw,h:sh,r:0};
with(this.__shadow03)
{
moveTo(- sw,(- sh) / 2);
beginGradientFill("linear",colors,alphas,ratios,matrix);
lineTo(0,(- sh) / 2);
lineTo(0,sh / 2);
lineTo(- sw,sh / 2);
lineTo(- sw,(- sh) / 2);
endFill();
}
this.__shadow03._visible = false;
};
FFlippingBookView.prototype._drawShadow04 = function()
{
this.__shadow04._x = 0;
this.__shadow04._y = 0;
this.__shadow04.clear();
var sw = 0.6 * this._pageWidth;
var sh = this.__shadowHeight;
var colors = [0,0];
var ratios = [0,255];
var alphas = [0,35 * this.sd];
var matrix = {matrixType:"box",x:- sw,y:(- sh) / 2,w:sw,h:sh,r:0};
with(this.__shadow04)
{
moveTo(- sw,(- sh) / 2);
beginGradientFill("linear",colors,alphas,ratios,matrix);
lineTo(0,(- sh) / 2);
lineTo(0,sh / 2);
lineTo(- sw,sh / 2);
lineTo(- sw,(- sh) / 2);
endFill();
}
this.__shadow04._visible = false;
};
FFlippingBookView.prototype.__isCorner = function(x, y)
{
if(x > this._pageWidth - this._autoFlip)
{
if(x < this._pageWidth)
{
if(y > this._pageHeight / 2 - this._autoFlip)
{
if(y < this._pageHeight / 2)
{
return true;
}
}
}
}
return false;
};
FFlippingBookView.prototype.__onMouseUp = function()
{
var _loc2_ = this._view;
if(_loc2_._bookState == this._constants.FLIPPING_STATE)
{
_loc2_._flipSound.start(0,1);
var _loc4_ = this._xmouse;
var _loc5_ = this._ymouse;
var _loc3_ = _loc2_.__ox;
_loc2_._bookState = this._constants.FLIPBACK_STATE;
if(_loc3_ < 0 && _loc4_ > 0 || _loc3_ > 0 && _loc4_ < 0)
{
}
_loc2_._bookState = this._constants.FLIPOVER_STATE;
}
};
FFlippingBookView.prototype.__onMouseDown = function()
{
var _loc2_ = this._view;
var _loc3_ = this._xmouse;
var _loc5_ = this._ymouse;
if(_loc3_ > - _loc2_._pageWidth && _loc5_ > (- _loc2_._pageHeight) / 2 && _loc3_ < - _loc2_._pageWidth + 30 && _loc5_ < _loc2_._pageHeight / 2 or _loc3_ > _loc2_._pageWidth - 30 && _loc5_ > (- _loc2_._pageHeight) / 2 && _loc3_ < _loc2_._pageWidth && _loc5_ < _loc2_._pageHeight / 2)
{
var _loc4_ = false;
if(_loc2_._bookState == this._constants.AUTOFLIP_STATE)
{
_loc4_ = true;
}
if(_loc3_ < 0)
{
var _loc8_ = _loc2_._baseObj.pagesSet[_loc2_._model._userCurrentPage];
var _loc7_ = _loc2_._model._curPageNumbers[0];
var _loc6_ = _loc2_._cache.__pagesHolders[_loc2_._model._userPages[_loc2_._model._curPageNumbers[0]]];
if(_loc2_._cache.__pagesExt[_loc8_] == true)
{
_loc2_._baseObj.onClick(_loc7_,_loc6_,_loc4_);
}
else
{
_loc2_._baseObj.onClick(_loc7_,_loc6_.media,_loc4_);
}
}
else if(_loc3_ > 0)
{
_loc8_ = _loc2_._baseObj.pagesSet[_loc2_._model._userCurrentPage];
_loc7_ = _loc2_._model._curPageNumbers[1];
_loc6_ = _loc2_._cache.__pagesHolders[_loc2_._model._userPages[_loc2_._model._curPageNumbers[1]]];
if(_loc2_._cache.__pagesExt[_loc8_] == true)
{
_loc2_._baseObj.onClick(_loc7_,_loc6_,_loc4_);
}
else
{
_loc2_._baseObj.onClick(_loc7_,_loc6_.media,_loc4_);
}
}
}
if(!_loc2_._flipOnClick && _loc2_._bookState != this._constants.AUTOFLIP_STATE)
{
return undefined;
}
if(_loc4_)
{
_loc2_._baseObj.onClickAndDrag();
_loc2_._flipSound.start(0,1);
if(_loc2_._flipOnClick)
{
_loc2_._bookState = this._constants.FLIPOVER_STATE;
}
else
{
_loc2_._bookState = this._constants.FLIPPING_STATE;
}
}
if(_loc3_ != 0 && (_loc3_ > - _loc2_._pageWidth && _loc5_ > (- _loc2_._pageHeight) / 2 && _loc3_ < - _loc2_._pageWidth + 30 && _loc5_ < _loc2_._pageHeight / 2 or _loc3_ > _loc2_._pageWidth - 30 && _loc5_ > (- _loc2_._pageHeight) / 2 && _loc3_ < _loc2_._pageWidth && _loc5_ < _loc2_._pageHeight / 2))
{
if(_loc2_._bookState == this._constants.UNACTIVE_STATE)
{
_loc2_._bookState = this._constants.FLIPPING_STATE;
var _loc9_ = Math.sqrt(_loc3_ * _loc3_ + _loc5_ * _loc5_);
var _loc10_ = Math.asin(_loc5_ / _loc9_);
_loc5_ = Math.tan(_loc10_) * _loc2_._pageWidth;
if(_loc5_ > _loc2_._pageHeight / 2)
{
_loc5_ = _loc2_._pageHeight / 2;
}
if(_loc5_ < (- _loc2_._pageHeight) / 2)
{
_loc5_ = (- _loc2_._pageHeight) / 2;
}
_loc2_.__oy = _loc5_;
if(_loc3_ < 0)
{
_loc2_.__page04._x = - _loc2_._pageWidth;
_loc2_.__ox = - _loc2_._pageWidth;
_loc2_._model.goBack();
}
if(_loc3_ > 0)
{
_loc2_.__page04._x = 0;
_loc2_.__ox = _loc2_._pageWidth;
_loc2_._model.goForward();
}
if(_loc2_._bookState != this._constants.UNACTIVE_STATE)
{
_loc2_.__pagesShadow._visible = true;
_loc2_.__shadow03._visible = true;
_loc2_.__shadow04._visible = true;
_loc2_.__shadow03.setMask(_loc2_.__shMask03);
_loc2_.__shadow04.setMask(_loc2_.__shMask04);
_loc2_.__drawShadow12Mask();
}
_loc2_.__oldX = _loc2_.__ox;
_loc2_.__oldY = _loc2_.__oy;
_loc2_._baseObj.onStartFlip(_loc2_._model._curPageNumbers[2]);
}
}
};
FFlippingBookView.prototype.onSetPages = function(i, j)
{
if(this._bookState == this._const.INIT_STATE)
{
this._bookState = this._const.UNACTIVE_STATE;
}
else if(this._bookState == this._const.UNACTIVE_STATE)
{
this.__redrawBook();
}
else if(this._bookState == this._const.GOTOPAGE_STATE && i == 1)
{
this.__redrawBook();
this.__oldX = 0;
this.__oldY = 0;
this._model.getNextGotoPage(this.__gotoPageIndex);
if(this._bookState != this._const.UNACTIVE_STATE)
{
this._flipSound.start(0,1);
this.__pagesShadow._visible = true;
this.__shadow03._visible = true;
this.__shadow04._visible = true;
this.__shadow03.setMask(this.__shMask03);
this.__shadow04.setMask(this.__shMask04);
this.__drawShadow12Mask();
}
}
};
FFlippingBookView.prototype.__onEnterFrame = function()
{
if(!this._visible || !this.enabledProp)
{
return undefined;
}
var _loc2_ = this._view;
var _loc3_ = this._xmouse;
var _loc4_ = this._ymouse;
if(_loc2_._bookState == _loc2_._const.AUTOFLIP_STATE)
{
if(!_loc2_.__isCorner(Math.abs(_loc3_),Math.abs(_loc4_)))
{
_loc2_._bookState = _loc2_._const.FLIPBACK_STATE;
}
}
else if(_loc2_._bookState == _loc2_._const.UNACTIVE_STATE && _loc2_._autoFlip != 0)
{
if(_loc2_.__isCorner(Math.abs(_loc3_),Math.abs(_loc4_)))
{
_loc2_._bookState = _loc2_._const.AUTOFLIP_STATE;
var _loc5_ = Math.sqrt(_loc3_ * _loc3_ + _loc4_ * _loc4_);
var _loc6_ = Math.asin(_loc4_ / _loc5_);
_loc4_ = Math.tan(_loc6_) * _loc2_._pageWidth;
if(_loc4_ > 0)
{
_loc4_ = _loc2_._pageHeight / 2;
}
if(_loc4_ < 0)
{
_loc4_ = (- _loc2_._pageHeight) / 2;
}
_loc2_.__oy = _loc4_;
_loc4_ = this._ymouse;
if(_loc3_ < 0)
{
_loc2_.__page04._x = - _loc2_._pageWidth;
_loc2_.__ox = - _loc2_._pageWidth;
_loc2_._model.goBack();
}
if(_loc3_ > 0)
{
_loc2_.__page04._x = 0;
_loc2_.__ox = _loc2_._pageWidth;
_loc2_._model.goForward();
}
if(_loc2_._bookState != this._constants.UNACTIVE_STATE)
{
_loc2_.__pagesShadow._visible = true;
_loc2_.__shadow03._visible = true;
_loc2_.__shadow04._visible = true;
_loc2_.__shadow03.setMask(_loc2_.__shMask03);
_loc2_.__shadow04.setMask(_loc2_.__shMask04);
_loc2_.__drawShadow12Mask();
}
_loc2_.__oldX = _loc2_.__ox;
_loc2_.__oldY = _loc2_.__oy;
_loc2_._baseObj.onStartFlip(_loc2_._model._curPageNumbers[2]);
}
}
if(_loc2_._bookState == _loc2_._const.FLIPPING_STATE || _loc2_._bookState == _loc2_._const.AUTOFLIP_STATE)
{
var _loc0_ = null;
_loc3_ = _loc2_.__oldX += (_loc3_ - _loc2_.__oldX) * _loc2_._pageSpeed;
var _loc0_ = null;
_loc4_ = _loc2_.__oldY += (_loc4_ - _loc2_.__oldY) * _loc2_._pageSpeed;
_loc2_.__movePage(_loc3_,_loc4_);
}
else if(_loc2_._bookState == _loc2_._const.FLIPOVER_STATE)
{
var _loc0_ = null;
_loc3_ = _loc2_.__oldX += (- _loc2_.__ox - _loc2_.__oldX) * _loc2_._closeSpeed;
var _loc0_ = null;
_loc4_ = _loc2_.__oldY += (_loc2_.__oy - _loc2_.__oldY) * _loc2_._closeSpeed;
_loc2_.__movePage(_loc3_,_loc4_);
if(_loc3_ / (- _loc2_.__ox) > _loc2_._minOffset)
{
_loc2_._bookState = _loc2_._const.UNACTIVE_STATE;
_loc2_._cache.restorePages();
_loc2_._model.putPage();
}
}
else if(_loc2_._bookState == _loc2_._const.FLIPBACK_STATE)
{
var _loc0_ = null;
_loc3_ = _loc2_.__oldX += (_loc2_.__ox - _loc2_.__oldX) * _loc2_._closeSpeed;
var _loc0_ = null;
_loc4_ = _loc2_.__oldY += (_loc2_.__oy - _loc2_.__oldY) * _loc2_._closeSpeed;
_loc2_.__movePage(_loc3_,_loc4_);
if(_loc3_ / _loc2_.__ox > _loc2_._minOffset)
{
_loc2_._baseObj.onFlipBack(_loc2_._model._curPageNumbers[2]);
_loc2_._bookState = _loc2_._const.UNACTIVE_STATE;
_loc2_._cache.restoreWorkPages();
_loc2_.redrawBook();
}
}
else if(_loc2_._bookState == _loc2_._const.GOTOPAGE_STATE)
{
var _loc0_ = null;
_loc3_ = _loc2_.__oldX += (- _loc2_.__ox - _loc2_.__oldX) * _loc2_._gotoSpeed;
var _loc0_ = null;
_loc4_ = _loc2_.__oldY += (_loc2_.__oy - _loc2_.__oldY) * _loc2_._gotoSpeed;
_loc2_.__movePage(_loc3_,_loc4_);
if(_loc3_ / (- _loc2_.__ox) > _loc2_._minOffset)
{
_loc2_._cache.restorePages();
_loc2_._model.putPage();
}
}
};
FFlippingBookView.prototype.__movePage = function(x, y)
{
var _loc4_ = this._pageHeight / 2;
var _loc5_ = this._pageWidth;
var _loc7_ = Math.sqrt((_loc4_ + this.__oy) * (_loc4_ + this.__oy) + _loc5_ * _loc5_);
var _loc6_ = Math.sqrt((_loc4_ - this.__oy) * (_loc4_ - this.__oy) + _loc5_ * _loc5_);
var _loc11_ = Math.sqrt((_loc4_ + y) * (_loc4_ + y) + x * x);
var _loc10_ = Math.sqrt((_loc4_ - y) * (_loc4_ - y) + x * x);
if(_loc11_ > _loc7_ || _loc10_ > _loc6_)
{
if(y < this.__oy)
{
var _loc8_ = Math.asin((_loc4_ - y) / _loc10_);
y = _loc4_ - Math.sin(_loc8_) * _loc6_;
x = x >= 0 ? Math.cos(_loc8_) * _loc6_ : (- Math.cos(_loc8_)) * _loc6_;
if(y > this.__oy)
{
if(this.__ox * x > 0)
{
y = this.__oy;
x = this.__ox;
}
else
{
y = this.__oy;
x = - this.__ox;
}
}
}
else
{
_loc8_ = Math.asin((y + _loc4_) / _loc11_);
y = Math.sin(_loc8_) * _loc7_ - _loc4_;
x = x >= 0 ? Math.cos(_loc8_) * _loc7_ : (- Math.cos(_loc8_)) * _loc7_;
if(y < this.__oy)
{
if(this.__ox * x > 0)
{
y = this.__oy;
x = this.__ox;
}
else
{
y = this.__oy;
x = - this.__ox;
}
}
}
}
if(this.__ox < 0 && x - this.__ox < 5 || this.__ox > 0 && this.__ox - x < 5)
{
if(this.__ox < 0)
{
x = - _loc5_ + 5;
}
if(this.__ox > 0)
{
x = _loc5_ - 5;
}
}
var _loc18_ = this.__oy - y;
var _loc19_ = this.__ox - x;
var _loc15_ = Math.atan(_loc18_ / _loc19_);
var _loc9_ = 2 * _loc15_;
var _loc17_ = _loc9_ * 57.29577951308232;
var _loc16_ = Math.sin(_loc9_);
var _loc14_ = Math.cos(_loc9_);
var _loc13_ = x + (_loc4_ + this.__oy) * _loc16_ - (_loc5_ - this.__ox) / 2 * _loc14_;
var _loc12_ = y - (_loc4_ + this.__oy) * _loc14_ - (_loc5_ - this.__ox) / 2 * _loc16_;
this.__page03._rotation = _loc17_;
this.__page03._x = _loc13_;
this.__page03._y = _loc12_;
this.__drawMasks(_loc15_,_loc13_,_loc12_,x,y);
this.__page03._visible = true;
this.__page04._visible = true;
};
FFlippingBookView.prototype.__drawMasks = function(beta, x, y, _mx, _my)
{
var pageH = this._pageHeight;
var pageH2 = pageH / 2;
var pageW = this._pageWidth;
var r = Math.sqrt((this.__ox - _mx) * (this.__ox - _mx) + (this.__oy - _my) * (this.__oy - _my));
var alpha = 2 * beta;
var cos_a = Math.cos(alpha);
var sin_a = Math.sin(alpha);
var cos_b = Math.cos(beta);
var sin_b = Math.sin(beta);
var tan_a = sin_a / cos_a;
var tan_b = Math.tan(beta);
var bx = 0;
var by = 0;
var ax = 0;
var ay = pageH;
y += pageH2;
bx = x - y / tan_a;
ax = bx - pageH * tan_b;
if(beta == 0)
{
if(this.__ox < 0 && x < 0)
{
x = ax = bx = - pageW;
}
else if(this.__ox > 0 && x > 0)
{
x = ax = bx = pageW;
}
else
{
ax = bx = 0;
}
}
var cx = this.__ox <= 0 ? - pageW : pageW;
var cy = 0;
var dx = cx;
var dy = pageH;
var k = this.__ox <= 0 ? 1 : 0;
var px = x + k * pageW * cos_a;
var py = y + k * pageW * sin_a;
var fx = px - pageH * sin_a;
var fy = py + pageH * cos_a;
var lx = cx;
var ly = beta == 0 ? -1 : (bx - cx) / tan_b;
var tmpx = 0;
var tmpy = 0;
var ccx = cx;
var ddx = dx;
cx = 0;
dx = 0;
if(this._transpPage04)
{
ccx = ddx = cx;
}
if(ly < 0 || ly > pageH)
{
with(this.__mask03)
{
clear();
moveTo(ax,ay);
beginFill(16776960,100);
lineTo(bx,by);
lineTo(px,py);
lineTo(fx,fy);
lineTo(ax,ay);
endFill();
}
with(this.__mask12)
{
clear();
moveTo(ax,ay);
beginFill(0,100);
lineTo(bx,by);
lineTo(cx,cy);
lineTo(dx,dy);
lineTo(ax,ay);
endFill();
}
with(this.__shMask03)
{
clear();
moveTo(ax,ay);
beginFill(16776960,100);
lineTo(bx,by);
lineTo(px,py);
lineTo(fx,fy);
lineTo(ax,ay);
endFill();
}
with(this.__shMask04)
{
clear();
moveTo(ax,ay);
beginFill(0,100);
lineTo(bx,by);
lineTo(ccx,cy);
lineTo(ddx,dy);
lineTo(ax,ay);
endFill();
}
with(this.__pagesShadow)
{
_rotation = beta * this.radIndex;
_xscale = this.__ox <= 0 ? (- r) / 4 : r / 4;
ay -= pageH2;
by -= pageH2;
var ab = Math.sqrt((ax - bx) * (ax - bx) + (ay - by) * (ay - by));
_alpha = 2 * pageW - r >= 50 ? 100 : 2 * (2 * pageW - r);
_x = bx - ab / 2 * sin_b;
_y = by + ab / 2 * cos_b;
}
with(this.__shadow03)
{
_rotation = this.__pagesShadow._rotation;
_xscale = this.__pagesShadow._xscale;
_alpha = this.__pagesShadow._alpha;
_x = this.__pagesShadow._x;
_y = this.__pagesShadow._y;
}
with(this.__shadow04)
{
_rotation = this.__pagesShadow._rotation;
_xscale = - this.__pagesShadow._xscale;
_alpha = this.__pagesShadow._alpha;
_x = this.__pagesShadow._x;
_y = this.__pagesShadow._y;
}
}
else
{
if(bx > pageW || bx < - pageW)
{
bx = ax;
by = ay;
tmpx = cx;
tmpy = cy;
cx = dx;
cy = dy;
dx = tmpx;
dy = tmpy;
px = fx;
py = fy;
}
with(this.__mask03)
{
clear();
moveTo(lx,ly);
beginFill(16711680,100);
lineTo(px,py);
lineTo(bx,by);
lineTo(lx,ly);
endFill();
}
with(this.__mask12)
{
clear();
moveTo(lx,ly);
beginFill(0,100);
lineTo(bx,by);
lineTo(cx,cy);
lineTo(dx,dy);
lineTo(lx,dy);
lineTo(lx,ly);
endFill();
}
with(this.__shMask03)
{
clear();
moveTo(lx,ly);
beginFill(16711680,100);
lineTo(px,py);
lineTo(bx,by);
lineTo(lx,ly);
endFill();
}
with(this.__shMask04)
{
clear();
moveTo(lx,ly);
beginFill(16711680,100);
lineTo(ccx,cy);
lineTo(bx,by);
lineTo(lx,ly);
endFill();
}
with(this.__pagesShadow)
{
_rotation = beta * this.radIndex;
_xscale = this.__ox <= 0 ? (- r) / 4 : r / 4;
ly -= pageH2;
by -= pageH2;
var bl = Math.sqrt((lx - bx) * (lx - bx) + (ly - by) * (ly - by));
_alpha = 2 * pageW - r >= 50 ? 100 : 2 * (2 * pageW - r);
_x = by >= ly ? lx - bl / 2 * sin_b : bx - bl / 2 * sin_b;
_y = by >= ly ? ly + bl / 2 * cos_b : by + bl / 2 * cos_b;
}
with(this.__shadow03)
{
_rotation = this.__pagesShadow._rotation;
_xscale = this.__pagesShadow._xscale;
_alpha = this.__pagesShadow._alpha;
_x = this.__pagesShadow._x;
_y = this.__pagesShadow._y;
}
with(this.__shadow04)
{
_rotation = this.__pagesShadow._rotation;
_xscale = - this.__pagesShadow._xscale;
_alpha = this.__pagesShadow._alpha;
_x = this.__pagesShadow._x;
_y = this.__pagesShadow._y;
}
}
this.__page03.setMask(this.__mask03);
this.__shadow03.setMask(this.__shMask03);
this.__shadow04.setMask(this.__shMask04);
this.__ox <= 0 ? this.__page01.setMask(this.__mask12) : this.__page02.setMask(this.__mask12);
};
FFlippingBookView.prototype.directGotoPage = function(n)
{
if(this._bookState != this._const.UNACTIVE_STATE)
{
return undefined;
}
this._model._currentPage = this._model._realPageNumber(n);
this._cache.restoreDirectGotoPages();
this._model.__direction = -1;
this._model.putPage();
this.__page01.setMask(null);
this.__page02.setMask(null);
};
FFlippingBookView.prototype.gotoPage = function(n)
{
if(this._bookState != this._const.UNACTIVE_STATE)
{
return undefined;
}
this._bookState = this._const.GOTOPAGE_STATE;
this.__gotoPageIndex = this._model._realPageNumber(n);
if(this._model._currentPage > this.__gotoPageIndex)
{
this.__page04._x = - this._pageWidth;
this.__ox = - this._pageWidth;
this.__oy = (- this._pageHeight) / 2;
}
if(this._model._currentPage < this.__gotoPageIndex)
{
this.__page04._x = 0;
this.__ox = this._pageWidth;
this.__oy = (- this._pageHeight) / 2;
}
this.__oldX = 0;
this.__oldY = 0;
this._model.getNextGotoPage(this.__gotoPageIndex);
if(this._bookState != this._const.UNACTIVE_STATE)
{
this._flipSound.start(0,1);
this.__pagesShadow._visible = true;
this.__shadow03._visible = true;
this.__shadow04._visible = true;
this.__shadow03.setMask(this.__shMask03);
this.__shadow04.setMask(this.__shMask04);
this.__drawShadow12Mask();
}
};
Object.registerClass("FFlippingBookSymbol",FFlippingBookClass);